home *** CD-ROM | disk | FTP | other *** search
/ Night Owl 6 / Night Owl's Shareware - PDSI-006 - Night Owl Corp (1990).iso / 013a / font_m21.zip / C_DEMO.C < prev    next >
Text File  |  1991-08-01  |  3KB  |  86 lines

  1. #include <dos.h>
  2. #include <conio.h>
  3. #include "demo.h"
  4. #include <stdio.h>
  5.  
  6.  /*-------------------------------------------------------------------------
  7.     Font is saved in the filenamed DEMO.PAS.  To use the font, you must call
  8.    interrupt 10h, function 11h, sub-function 10h to load up the font.
  9.    
  10.    The following are the parameter needed to call the function:
  11.   
  12.                   AX  =  0x1110      (ah = 0x11, al = 0x10)
  13.           BH  =  bytes per character 
  14.           BL  =  block to load to.  (use 0)
  15.           CX  =  number of character defined by table
  16.           DX  =  starting character value
  17.           ES  =  segment of the table 
  18.           BP  =  offset of the table 
  19.  
  20.    Notice:  You should always upload the character immediately after set
  21.             the Video mode.  Also you must make sure that page 0 is active.
  22.         If it is not call immediately after the video mode set, some
  23.         side effects may occur.  I had experience some palette errors
  24.         my self, when I call this function with out changing video 
  25.         mode.  This doesn't happen all the time, however.  But be on 
  26.         the safe side is the best.   
  27.    
  28.    FONT MANIA will supply you with the height of the font.  It is defined
  29.    by your label name with "_POINTS" added at the end of the string.  For
  30.    example, if your label reference is call DEMO, then DEMO_POINTS will 
  31.    represent the byte-per-character of the font (the height of the font).
  32.    
  33.    Set the CX to 256 if you want to upload the whole font.   If you want to 
  34.    only upload part of font.  Set CX to whatever number of the character 
  35.    you want to upload, and set DX to the first character you want to upload.
  36.    
  37.    For example, suppose you want to upload the character 65 to 88, 
  38.    ('A' to 'Z') and the label reference is DEMO.  Here are the parameter
  39.    needed:
  40.    
  41.          AX  =  0x1110;
  42.          BH  =  DEMO_POINTS;
  43.          BL  =  0;
  44.          CX  =  24;               ( 24 characters to load )
  45.          DX  =  65;               ( first character to load )
  46.          ES  =  FP_SEG(DEMO);
  47.          BP  =  FP_OFF(DEMO);
  48.          
  49.    See below for examples of how to set the registers. 
  50.          
  51.  
  52.  --------------------------------------------------------------------------*/
  53.  
  54.  
  55. void main(void) {
  56.   int i;
  57.   struct REGPACK r;
  58.  
  59.   printf("This is font test\n\n");
  60.  
  61.   for (i=0; i<256; i++) {
  62.     cprintf(" %c", i);
  63.     if (!(i % 32) && (i != 0))
  64.       printf("\n");
  65.   }
  66.   printf("\n\nPress any key to load the font...\n");
  67.   getch();
  68.  
  69.   r.r_ax = 3;                /* always set video mode first */
  70.   intr(0x10, &r);
  71.  
  72.   r.r_ax = 0x1110;
  73.   r.r_bx = 0x0e00;
  74.   r.r_cx = 256;
  75.   r.r_dx = 0;
  76.   r.r_es = FP_SEG(TEST);
  77.   r.r_bp = FP_OFF(TEST);
  78.   intr(0x10, &r);
  79.  
  80.   printf("\nFont loaded\nPress any key...");
  81.   getch();
  82.  
  83. }
  84.  
  85.  
  86.